<template>
    <div class="job-list">
        <div class="job-list-list" v-for="(item, index) in jobList" :key="index">
            <div class="job-list-left">
                <div class="job-list-left-top">
                    <el-popover placement="top-start"
                                trigger="hover"
                                :disabled="$pop.getEllipsis(item.name,10)===item.name"
                    >
                        <div>{{item.name}}</div>
                        <div slot="reference" class="job-name">{{$pop.getEllipsis(item.name,10)}}</div>
                    </el-popover>

                    <div class="job-money">
                        <span>{{(item.tax===0?'税前':'税后')}}</span>
                        {{(item.salaryPerMonthLow+'-'+item.salaryPerMonthHigh)}}W
                        <span>/{{item.salaryCount}}年</span>
                    </div>
                    <div class="job-time">{{item.rdtime}}</div>
                </div>
                <div class="job-list-left-bottom">
                    <span>{{item.city}}</span>
                    <span>|</span>
                    <span>{{item.workTimeStr}}</span>
                    <span>|</span>
                    <span>{{item.licenseTypeIdStr}}</span>
                    <span>|</span>
                    <span>{{item.recruitingNumbers}}人</span>
                </div>
            </div>


            <div class="job-list-right">
                <div class="job-list-right-oneself" v-if="platform">
                    <div class="job-list-right-img">
                        <img src="../../assets/img/resume/zijian.png">
                        自荐数&nbsp; {{item.onlineResumeNums == null?0:item.onlineResumeNums}}
                    </div>
                    <el-button class="primarys-button" @click="doResume(item,0)">查看自荐简历</el-button>
                </div>

                <div class="job-list-right-platform">
                    <div class="job-list-right-img">
                        <img src="../../assets/img/resume/pingtai.png">
                        平台推荐数&nbsp; {{item.onlResRecommendNums ==null?0:item.onlResRecommendNums}}
                    </div>
                    <el-button class="primarys-button" @click="doResume(item,1)">查看平台推荐简历</el-button>
                </div>
            </div>
        </div>
    </div>


</template>

<script>
  import _g from '../../assets/utils/global'
  import * as _ from 'underscore'

  export default {
    props: ['platform', 'nowPage', 'url', 'total', 'type'],
    data() {
      return {
        jobList: []
      }
    },
    methods: {
      doResume(item, obj) {
        localStorage.setItem('job_List_jobId', item.id)//职位ID
        localStorage.setItem('job_List_onlResRecommendNums', item.onlResRecommendNums == null ? 0 : item.onlResRecommendNums)//平台推荐数
        localStorage.setItem('job_List_onlineResumeNums', item.onlineResumeNums == null ? 0 : item.onlineResumeNums)//自荐数
        localStorage.setItem('job_List_type', obj)//推荐状态
        localStorage.setItem('job_List_data', JSON.stringify(this.jobList))//总数据
        //查看自荐简历
        this.$emit('input', '1')
      },
      doClick() {
        _g.apiPost('/company/selectJobInfoByCompanyId.do', {
          currPageNo: this.nowPage,
          pageSize: 10,
          type: this.type
        }).then(res => {
          if (!_.isNull(res)) {
            console.log(res.data.list)
            if (res && res.status === 0) {
              this.jobList = _.filter(res.data.list, t => {
                return Number(t.jobState) !== 3
              })
              this.$emit('onJobList', this.jobList)
              this.$emit('getTotal', res.data.total)
            } else {
              _g.toMessage({
                status: res.status,
                msg: '查询失败'
              })
            }
          }
        })
      }
    },
    created() {
      this.doClick()
    },
    watch: {
      nowPage(val) {
        this.doClick()
      }
    },
    components: {}

  }
</script>

<style lang="scss" scoped>
    .job-list {
        margin: 20px 0;
        width: 980px;
        min-height: 100px;
        background: #fff;

        .job-list-list {
            padding: 22px 50px;
            width: 100%;
            height: 112px;
            border-bottom: 1px solid #eee;
            display: flex;
            justify-content: space-between;

            &:hover {
                background: #f7fdff;
            }

            .job-list-left {
                .job-list-left-top {
                    margin: 0 0 20px 0;
                    display: flex;
                    justify-content: flex-start;
                    align-items: flex-end;

                    .job-name {
                        font-size: 18px;
                        color: #333333;
                        flex-basis: 200px;
                    }

                    .job-money {
                        margin: 0 20px;
                        font-size: 16px;
                        color: #f15c18;
                        flex-shrink: 0;

                        span {
                            font-size: 12px;
                            color: #999;
                        }
                    }

                    .job-time {
                        font-size: 14px;
                        color: #999;
                        flex-shrink: 0;
                    }
                }

                .job-list-left-bottom {
                    font-size: 14px;
                    color: #666;
                    display: flex;
                    justify-content: flex-start;

                    span {
                        margin-right: 15px;
                    }
                }
            }

            .job-list-right {
                display: flex;
                justify-content: space-between;

                .job-list-right-img {
                    display: flex;
                    align-items: center;

                    img {
                        margin: 0 8px 0 0;
                    }
                }

                .job-list-right-oneself {
                    margin: 0 30px 0 0;
                }

                .el-button {
                    margin: 12px 0 0 0;
                }
            }
        }
    }
</style>
